package com.fenxiao.agent.service.impl;

import java.util.List;

import com.fenxiao.agent.dao.AgentDao;
import com.fenxiao.agent.entity.Agent;
import com.fenxiao.agent.service.AgentService;
import com.fenxiao.common.Pager;

public class AgentServiceImpl implements AgentService {
	
	private AgentDao agentDao;
	public Agent checkLogin(Agent agent)throws Exception{
		Agent agen=agentDao.queryAgent(agent.getAgentAccount());
		if(agen!=null&&agen.getAgentPass().equals(agent.getAgentPass())){
			return agen;//��½�ɹ�
		}else{
			return null;//��¼ʧ��
		}
		
	}
	 /**
	  * ��ҳ��ѯ
	  */
	public Pager queryPage(int pageSize,int page,String search,long agentId){
		
		return agentDao.queryPage(pageSize, page, search, agentId);
	}
	/**
	  * ��ҳ��ѯ������
	  */
	public Pager findPage(int pageSize,int page,String search,long agentId){
		return agentDao.findPage(pageSize, page, search, agentId);
	}
	
 	/**
 	 * ��Ӵ�����
 	 */
 	public int addAgent(Agent agent){
 		return agentDao.addAgent(agent);
 	}
	
	/**
 	 * �޸Ĵ�����
 	 */
 	public int updateAgent(Agent agent){
 		return agentDao.updateAgent(agent);
 	}
 	/**
 	 * ��ѯ������
 	 */
 	public Agent queryAgentInfo(long agentId){
 		return agentDao.queryAgentInfo(agentId);
 	}
 	/**
	  * ��ҳ��ѯ������
	  */
	public Pager findAgentPage(int pageSize,int page,String search){
		return agentDao.findAgentPage(pageSize, page, search);
	}
	/**
	  * ��ҳ��ѯ�ϻ���
	  */
	public Pager findPartnerPage(int pageSize,int page,String search){
		return agentDao.findPartnerPage(pageSize, page, search);
	}
	
	/**
	  * ��ҳ��ѯ�ϻ��˼���
	  */
	public List<Agent> findPartnerList(){
		return agentDao.findPartnerList();
	}
	/**
	 * ����ɾ��
	 */
	public int deleteAllAgent(String number){
		return agentDao.deleteAllAgent(number);
	}
	/**
	 * ɾ��
	 */
	public int deleteAgent(long agentId){
		return agentDao.deleteAgent(agentId);
	}
	/**
	  * ��ҳ��ѯ������
	  */
	public Pager selectAgentPage(int pageSize,int page,String search){
		return agentDao.selectAgentPage(pageSize, page, search);
	}
	public AgentDao getAgentDao() {
		return agentDao;
	}


	public void setAgentDao(AgentDao agentDao) {
		this.agentDao = agentDao;
	}
	//查询合伙人
	@Override
	public Agent queryHehuo(Long agentId) {
		
		return agentDao.queryHehuo(agentId);
	}
	@Override
	public Agent quertwo(Long pranId) {
		      Agent agent = agentDao.quertwo(pranId);
		return agent;
	}
	@Override
	public List<Agent> queryallAgent(long agentId) {
		
		return agentDao.queryallAgent(agentId);
	}
	
	
	
	
	
	
}
